<template>
  <div class="GfVajraDistrict">
    <div class="page">
      <div
        class="row"
        v-for="(row, rowIndex) in componentData.attributes.rowNum"
        :key="rowIndex"
      >
        <div
          class="col"
          :style="{
            width: `${100 / componentData.attributes.colNum}%`,
            flex: `0 1 ${100 / componentData.attributes.colNum}%`,
            paddingLeft: addUnit(componentData.styles.itemPadding),
            paddingRight: addUnit(componentData.styles.itemPadding)
          }"
          v-for="(item, index) in componentData.attributes.colNum"
          :key="index"
        >
          <div class="img-wrap">
            <i :class="['iconfont', componentData.icon]"></i>
          </div>
          <div class="label">金刚区</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import { defineComponent } from 'vue'
import { addUnit } from '@/utils'

export default defineComponent({
  name: 'GfVajraDistrict',
  props: ['componentData'],
  setup() {
    return {
      addUnit
    }
  }
})
</script>

<style lang="scss" scoped>
.GfVajraDistrict {
  .page {
    .row {
      display: flex;
      align-items: stretch;
      flex-wrap: wrap;
      padding: 10px 0;
      .col {
        box-sizing: border-box;
        overflow: hidden;
        .img-wrap {
          max-width: 100%;
          margin: 0 auto;
          text-align: center;
          overflow: hidden;
          .iconfont {
            font-size: 30px;
          }
        }
        .label {
          font-size: 14px;
          color: #25252c;
          line-height: 16px;
          margin-top: 8px;
          text-align: center;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
        }
      }
    }
  }
}
</style>
